slideSwitch();
		   //usergsd();
 function usergsd(){
			  var gsd=$('#usergsd');
			  gsd.wrap('<div class="ych-items"></div>').css('z-index',9);
			  setTimeout(function(){gsd.animate({top:-700,right:0},800).animate({top:-300,right:0},800)},800)
}

function slideSwitch(){
			var stay=6;
			var fade=0.7;
			var msec=1000;
			var timer=400;
			var timeout;
			var prev=next=0;
			var slider=$('#slider');
			var slideindex=true;
			var controls=false;
			var html='';
			var term=slider.children('li');
			var len=term.length;slider.wrap('<div id="full-screen-slider" class="full-screen-slider"></div>');
			if(slideindex){
				if(len>1){
					html+='<div class="banner_pagination">';
					html+='<ul id="pagination" style="">';
					for(var i=1;i<=len;i++){
						html+='<li '+(i==1?'class="current"':'')+'></li>'};
						html+='</ul>';
						html+='</div>'
				}
			};
			
			if(controls){
				html+='<div class="slider-updown">';
				html+='<a href="#" class="button prev" data-rel="prev">prev</a>';
				html+='<a href="#" class="button next" data-rel="next">next</a>';
				html+='</div>'
			};
				slider.parent('.full-screen-slider').wrap('<div id="banner_wrap"></div>').css({'position':'relative','overflow':'hidden'}).after(html);
				var thumbCont=slider.parent().siblings('.banner_pagination');
				var thumb=thumbCont.find('li');
				var button=slider.parent().siblings('.slider-updown');
				slider.fadeIn();
				if(len==1){term.first().fadeIn()};
				button.find('.button').bind('click',function(){
					var self=$(this).attr('data-rel');
					if(self=='prev'){
						if(prev==0){next=len-1}else{next=prev-1}}else if(self=='next'){if(prev==len-1){next=0}else{next=prev+1}};
						autoPlay();
						return false});
				thumb.bind('click',function(){
					next=thumb.index($(this));
					clearTimeout(timeout);
					changePlay(next);
					if(next==len-1){next=0}else{next++}});
					slider.hover(function(){clearTimeout(timeout)},function(){if(len>1){timeout=setTimeout(autoPlay,stay*msec)}});
					var changePlay=function(next){
						term.eq(prev).fadeOut(fade*msec);term.eq(next).fadeIn(fade*msec);thumb.removeClass('current');
						thumb.eq(next).addClass('current');
						if(typeof($('#usergsd')[0])!=''){$('#usergsd').find('.opacity').css({opacity:term.eq(next).attr('data-opacity')})};
						prev=next
					};
				var autoPlay=function(){
					clearTimeout(timeout);
					changePlay(next);
					next=prev+1;
					if(next>=len){next=0};
					timeout=setTimeout(autoPlay,stay*msec)
				};
				if(len>1){autoPlay()}
		}
			
